home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / tmhost2.zip / TMHOST2.SCR < prev    next >
Text File  |  1990-12-24  |  68KB  |  2,192 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;
  3. ;; HOST.SCR by Tsung Hu, 21 May, 1990
  4. ;; Modified by Richard Bailey Dec 1990
  5. ;; Renamed TMHOST2, see comments throughout file explaining changes.
  6. ;;
  7.  
  8. #include "SCREENIO.SCR"
  9.  
  10. ;
  11. ; constants
  12. ;          
  13. EchoToLocal = 1                    ; variables set to TRUE
  14. EchoToRemote = 1                   ; for SCREENIO routines
  15. TRUE = 1
  16. FALSE = 0
  17. FOREVER = TRUE
  18. TMLOG = "\TM"
  19. FILEDIR = "\TM\HOST.DIR"           ; temp. file for F)ile command
  20. MENUCOMMAND = " Minutes left. Enter Command  "
  21. XPERTCOMMAND = " Minutes left. Enter Command (? for help)  "
  22. TMHOST = "*** TMHOST BBS ***"
  23.  
  24. ;
  25. ; global variables
  26. ;
  27. integer access,addmsg,areanum,exist,mail,mins,msgmail,msgread,msgs,ontime
  28. integer reply,savedmsg,timeleft,userlevel,xpert
  29. integer NEWUSERLEVEL,NUSERLEVEL,SYSOPLEVEL,DETECTBAUD,INITIALBAUD,YELLTIME
  30. integer YELLSOUND,LOCAL,COUNT
  31.  
  32. string area,ch,filename,logontime,name,now,password,subject,today
  33. string totalmsgs,username,wdate
  34. string GENBKCOL,HEADERBKCOL,GENTEXTCOL,HEADERTEXTCOL,HILITECOL,MSGBASE
  35. string SPECIALTEXTCOL,LOCALBOXCOL,LOCALCOL,TMDIR,HOSTDIR,DOWNLOADDIR
  36. string MSBASE0,MSBASE1,MSBASE2,MSBASE3,MSBASE4,MSBASE5,MSBASE6,MSBASE7
  37. string MSBASE8,MSBASE9  
  38. string area0,area1,area2,area3,area4,area5,area6,area7,area8,area9
  39.  
  40.  
  41. Procedure HostConfig               ; read the configuration file
  42.    string s,ch                     ; TMHCFG.HST from the current directory
  43.    open "TMHCFG.HST"
  44.      if success
  45.        read s
  46.        atoi s,NEWUSERLEVEL         ; new user level
  47.        read s
  48.        atoi s,NUSERLEVEL           ; normal user level
  49.        read s
  50.        atoi s,SYSOPLEVEL           ; sysop level
  51.        read s
  52.        atoi s,DETECTBAUD           ; detect baud rate
  53.        read s
  54.        atoi s,INITIALBAUD          ; initial baud rate
  55.        read s
  56.        atoi s,YELLTIME             ; yell time
  57.        read s
  58.        atoi s,YELLSOUND            ; yell sound
  59.        read TMDIR
  60.        read HOSTDIR                ; directory containing H*.HST
  61.        read DOWNLOADDIR            ; download directory
  62.                                    ; (upload always go to Telemate
  63.                                    ; downlaod directory)
  64.        read GENBKCOL               ; general background colour
  65.        read GENTEXTCOL             ; general text colour
  66.        read HILITECOL              ; hilite colour 
  67.        read HEADERBKCOL            ; header background colour
  68.        read HEADERTEXTCOL          ; header text colour 
  69.        read SPECIALTEXTCOL         ; e.g. questionnaire text colour
  70.        read LOCALBOXCOL            ; local box colour e.g. starting Host mode
  71.        read LOCALCOL               ; local text colour
  72.        read s
  73.        atoi s,COUNT                ; number of message areas
  74.        read area0                  ; message areas 
  75.        read MSBASE0                ; and files
  76.        read area1
  77.        read MSBASE1
  78.        read area2 
  79.        read MSBASE2
  80.        read area3 
  81.        read MSBASE3
  82.        read area4 
  83.        read MSBASE4
  84.        read area5
  85.        read MSBASE5 
  86.        read area6 
  87.        read MSBASE6
  88.        read area7
  89.        read MSBASE7
  90.        read area8 
  91.        read MSBASE8 
  92.        read area9 
  93.        read MSBASE9
  94.        read s
  95.        atoi s,ANSILOCAL
  96.        close
  97.        set alarmtime,YELLTIME      ; setup yell alarm
  98.        set alarmsound,YELLSOUND
  99.      else
  100.        print "Cannot open TMHCFG.HST in the current directory"
  101.        print
  102.        print "Do you want to setup host mode (y/n)? ",
  103.        repeat
  104.          inputch ch
  105.        until success
  106.          if ch="y"
  107.            print ch
  108.            script "TMHCFG"         ; chain to TMHCFG.SCR
  109.          else
  110.            print "n"               ; abort host mode
  111.            print "Host mode aborted"
  112.            stop
  113.          endif
  114.      endif
  115. Endproc                                         
  116.  
  117. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  118. ;; Function to calculate time difference in minutes between time1 and time2
  119. ;; for calculation of time left for user, ties in <timeleft> and <ontime>
  120. ;; Modification of Difftime function from Toolbox3.scr
  121. ;;
  122.  
  123. Procedure CalcTime string time1,time2,integer minutes
  124.   integer h1,m1,h2,m2     ; <time1> and <time2> in "HH:MM:SS" format
  125.   string hh,mm
  126.   substr time1,1,2,hh              ; get hour part
  127.   substr time1,4,2,mm              ; get minute part
  128.   atoi hh,h1                       ; convert to integer
  129.   atoi mm,m1
  130.   substr time2,1,2,hh              ; get hour,minute and second from <time2>
  131.   substr time2,4,2,mm
  132.   atoi hh,h2
  133.   atoi mm,m2
  134.   if h2<h1                         ; <time2> pass mid-night
  135.     h2 = h2 + 24
  136.   endif
  137.   minutes = (h2-h1)*60 + (m2-m1)
  138. EndProc
  139.  
  140. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  141. ;; New Procedure FULLDATE 
  142. ;; Setup a date string
  143. ;; When full is TRUE, date format e.g. 'Friday December 14, 1990'
  144. ;; When full is FALSE, date format DD-MM-YY e.g. '14-12-90'
  145. ;; Telemate version of date is MM-DD-YY e.g '12-14-90'
  146. ;;
  147.  
  148. Procedure FullDate string strdate,integer full
  149.   string datestr,mm,dd,yy,day,month,year,century
  150.   integer y1,d1,daynum,totaldays,numdays
  151.   date datestr                     ; get date string
  152.   substr datestr,1,2,mm            ; month
  153.   substr datestr,4,2,dd            ; date
  154.   substr datestr,7,2,yy            ; year
  155.   atoi yy,y1
  156.   atoi dd,d1
  157.   if not full
  158.     concat dd,"-"                  ; DD-MM-YY
  159.     concat dd,mm
  160.     concat dd,"-"
  161.     concat dd,yy
  162.     strdate = dd   
  163.   else
  164.     switch mm
  165.       case "01":
  166.         month = " January "
  167.         numdays = 0
  168.       case "02":
  169.         month = " February "
  170.         numdays = 31
  171.       case "03":
  172.         month = " March "
  173.         numdays = 59
  174.       case "04":
  175.         month = " April "
  176.         numdays = 90
  177.       case "05":
  178.         month = " May "
  179.         numdays = 120
  180.       case "06":
  181.         month = " June "
  182.         numdays = 151
  183.       case "07":
  184.         month = " July "
  185.         numdays = 181
  186.       case "08":
  187.         month = " August "
  188.         numdays = 212
  189.       case "09":
  190.         month = " September "
  191.         numdays = 243
  192.       case "10":
  193.         month = " October "
  194.         numdays = 273
  195.       case "11":
  196.         month = " November "
  197.         numdays = 304
  198.       case "12":
  199.         month = " December "
  200.         numdays = 334
  201.     endswitch
  202.     century = " 19"
  203.     if y1 > 99
  204.       century = " 20"
  205.     endif
  206.     totaldays = (y1-80)*365+1+(y1-80)/4+numdays+d1 
  207.     daynum = totaldays-((totaldays/7)*7)
  208.     switch daynum
  209.       case 0: day = " Monday"
  210.       case 1: day = " Tuesday"
  211.       case 2: day = " Wednesday"
  212.       case 3: day = " Thursday"
  213.       case 4: day = " Friday"
  214.       case 5: day = " Saturday"
  215.       case 6: day = " Sunday"
  216.     endswitch              
  217.     concat day,month
  218.     concat day,dd
  219.     concat day,","
  220.     concat day,century
  221.     concat day,yy
  222.     strdate = day                  ; DAY MONTH DD, CENTURY YY
  223.   endif                  
  224. Endproc    
  225.  
  226. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  227. ;; New graphic delay routine used in message saving etc.
  228. ;; 
  229.  
  230. Procedure Save
  231.   integer i
  232.   i = 0
  233.   while i < 15
  234.     Echo "."
  235.     delay 1
  236.     i = i+1
  237.   endwhile
  238. Endproc
  239.  
  240. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  241. ;; New procedure LOCALVIEW 
  242. ;; who's online
  243. ;;
  244.  
  245. Procedure LocalView                ; shows user on line locally
  246.   EchoHilite
  247.   EchoColor LOCALBOXCOL
  248.   at 0,0
  249.   print "╔════════════════════════════╡                    ╞════════════════════════════╗"
  250.   print "║ ONLINE:                                                     DATE:            ║"
  251.   print "╚══════════════════════════════════════════════════════════════════════════════╝^M^J"
  252.   EchoColor LOCALCOL
  253.   at 31,0
  254.   print TMHOST
  255.   at 68,1
  256.   print today
  257.   at 10,1
  258.   print username                   ; user online
  259.   EchoNormal
  260. Endproc
  261.  
  262. Procedure HostBegin 
  263.    set zautodownload,off
  264.    set zrecovery,off 
  265.    set usagelog,on
  266.    set baud,INITIALBAUD
  267.    clear key                       ; clear keyboard buffer
  268.    clear com                       ; clear com buffer
  269.    clear text                      ; clear screen
  270.    print
  271.    print
  272.    print "Initializing modem"
  273.    put "^)","~ATQ0E0X4^M~",        ; send modem answer string
  274.    delay 5
  275.    clear text
  276.    EchoColor LOCALBOXCOL
  277.    print "^M^J^M^J^M^J^M^J"
  278.    print "            ┌────────────────────┐ "
  279.    print "        ╒═══╡          Host Mode ╞════════════════════╕ "
  280.    print "        │   └────────────────────┘                    │ "
  281.    print "        │           : Waiting for call.....           │ "
  282.    print "        │ ─────────────────────────────────────────── │ "
  283.    print "        │           : Press [   ] to exit Host Mode   │ "
  284.    print "        │             ' ' for configuration           │ "
  285.    print "        │             ' ' for local mode              │ "
  286.    print "        │             [     ] to terminate user       │ "
  287.    print "        │                                             │ "
  288.    print "        ╘═════════════════════════════════════════════╛ "
  289.    print
  290.    EchoColor LOCALCOL
  291.    at 14,6
  292.    print "TELEMATE"
  293.    at 14,8
  294.    print "STATUS"
  295.    at 13,10
  296.    print "OPTIONS"
  297.    at 29,10
  298.    print "ESC"
  299.    at 23,11
  300.    print "C"
  301.    at 23,12
  302.    print "L"
  303.    at 23,13
  304.    print "Alt-H"
  305.    at 44,8
  306.    clear key                       ; clear keyboard buffer
  307.    clear com                       ; clear com buffer     
  308.    
  309.                 ; Do calculations before answering call
  310.  
  311.    FullDate today,FALSE            ; string right way round, not full date
  312.    FullDate wdate,TRUE             ; full date string for welcome
  313.    MSGBASE = MSBASE0               ; message to sysop base
  314.    area = area0
  315.    areanum = 1                     ; message area number (command line)
  316.    access = TRUE 
  317.    usage "Switched to Host mode"
  318. Endproc
  319.  
  320. Procedure HostEnd
  321.   set zautodownload,on
  322.   set zrecovery,on
  323.   clear key                        ; clear keyboard buffer
  324.   clear com                        ; clear com buffer
  325.   clear text
  326.   print
  327.   print "Ending host mode"
  328.   put "^(","~",                    ; send modem init string
  329.   print
  330.   chdir HOSTDIR                    ; change to Host dir
  331.   delete FILEDIR                   ; delete temp file
  332.   chdir TMDIR                      ; change back to Telemate dir
  333.   usage "Terminating Host mode"
  334.   set usagelog,off
  335.   stop
  336. Endproc
  337.  
  338. Procedure Disconnect               ; end session
  339.   delay 10
  340.   if not LOCAL                     ; if remote
  341.     hangup
  342.   endif
  343.   set connection,modem
  344.   LOCAL = FALSE
  345. Endproc
  346.  
  347. Procedure InputChar string ch      ; input and display locally
  348.   repeat
  349.     If not LOCAL                   ; disconnect after 5 min. inactivity
  350.       whenidle 300,"^M^JInactivety period too long, Connection Terminated!^M^J~^*"
  351.       Usage "User disconnected - inactivity period too long"
  352.     endif
  353.     if not LOCAL                   ; get remote characters
  354.       getch ch
  355.     endif
  356.       if LOCAL or not success
  357.         inputch ch
  358.           if success
  359.             print ch,
  360.           endif
  361.       endif
  362.    until success or not connected
  363. Endproc
  364.  
  365. Procedure InputEcho string ch      ; input and echo to remote
  366.   InputChar ch
  367.   if not LOCAL
  368.     put ch,
  369.   endif
  370.   if ch = "^M"                     ; add line feed
  371.     Echo "^J"
  372.   endif
  373. Endproc
  374.  
  375. Procedure DotEcho string ch        ; input and echo "." to remote
  376.   InputChar ch
  377.   if not LOCAL
  378.     if ch="^H" or ch="^M"
  379.       put ch,
  380.     else
  381.       put ".",                     ; echo with "."
  382.     endif
  383.   endif
  384.   if ch = "^M"                     ; add line feed
  385.       Echo "^J"
  386.   endif
  387. Endproc
  388.  
  389. Procedure InputString string str   ; input a string
  390.   string ch
  391.   str = ""
  392.   repeat
  393.     InputEcho ch
  394.     if ch <> "^M"                  ; if return
  395.       if ch = "^H"                 ; if backspace
  396.         if str = ""                ; if string empty
  397.           Echo " "
  398.         else
  399.           Echo " ^H"
  400.         endif
  401.       endif
  402.       concat str,ch
  403.     endif
  404.   until ch = "^M" or not connected
  405.   if str="" or not connected
  406.     success = FALSE
  407.   else
  408.     success = TRUE
  409.   endif
  410. Endproc
  411.  
  412. Procedure InputFilename string filename,dir
  413.   string fname       
  414.   integer pos
  415.   InputString fname                ; input a filename
  416.   repeat
  417.     strpos fname,":",pos           ; strip drive part
  418.       if pos>0                     ; only view file
  419.          strdel fname,1,pos        ; in download dir
  420.       endif
  421.   until pos=0 or not connected
  422.   repeat
  423.     strpos fname,"\",pos           ; strip directory part
  424.       if pos>0
  425.          strdel fname,1,pos
  426.       endif
  427.   until pos=0 or not connected
  428.     if fname="" or not connected
  429.       success = FALSE
  430.       filename = ""
  431.     else
  432.       success = TRUE
  433.       filename = dir
  434.       concat filename,"\"          ; concat <dir>
  435.       strpos filename,"\\",pos
  436.         if pos>0
  437.           strdel filename,pos,1    ; avoid root directory
  438.         endif
  439.       concat filename,fname
  440.     endif
  441. Endproc  
  442.  
  443. Procedure Pause                    ; request a key
  444.   string ch
  445.   Echo "Press [ENTER] to continue "
  446.   InputEcho ch
  447.   Echo "^M^J"
  448.   if ch<>"^M"
  449.     Echo "^M^J"
  450.   endif
  451. Endproc
  452.  
  453. Procedure InputPassword string password
  454.   password = ""
  455.   repeat                           ; input password
  456.     DotEcho ch
  457.       if ch <> "^M"
  458.         if ch = "^H"
  459.           if password = ""
  460.             Echo " "
  461.           else
  462.             Echo " ^H"
  463.           endif
  464.         endif
  465.         concat password,ch
  466.       endif
  467.   until ch = "^M" or not connected
  468.     if password="" or not connected
  469.       success = FALSE
  470.     else
  471.       success = TRUE
  472.     endif
  473. Endproc                                         
  474.  
  475. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  476. ;; Added choice of y/n to [more] in Typefile procedure
  477. ;;
  478.  
  479. Procedure TypeFile string filename,integer more
  480.   string ch                        ; display a file
  481.   integer i
  482.   i = 0
  483.   open filename
  484.   if not success
  485.     Echo "File not found!^M^J"
  486.   else
  487.     while success
  488.       inputch ch
  489.       if success and ch = "^C"     ; operator break
  490.         clear com
  491.         Echo "^M^J"
  492.         exit
  493.       endif
  494.       if not LOCAL
  495.         getch ch
  496.           if success and ch = "^C" ; caller break
  497.             clear com
  498.             Echo "^M^J"
  499.             exit
  500.           endif
  501.       endif
  502.       read s                       ; display a line
  503.       Echo s
  504.       Echo "^M^J"  
  505.       i = i+1
  506.       if i = 22 and more           ; pause if <more> is TRUE
  507.         i = 0
  508.         Echo " More [y/N] "
  509.         InputChar ch
  510.         if ch = "^C" or ch = "N"   ; if no, stop
  511.           clear com
  512.           Echo "^M^J"
  513.           exit
  514.         endif
  515.         Echo "^M                    ^M"
  516.       endif  
  517.     endwhile
  518.     close
  519.     if more
  520.       Pause
  521.     endif
  522.   endif
  523. Endproc            
  524.  
  525. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  526. ;; New Procedure READMAIL
  527. ;; MSGBASE = message area.
  528. ;; At logon a choice is provided to read personal mail from 
  529. ;; messages areas. Checks the 'To    : name' field of message header
  530. ;; and displays appropriate message. An 'R' is placed in the 
  531. ;; 'To   :' string --> 'To  R :' which serves 2 purposes:
  532. ;; 1) The same messages are not displayed at future logons,
  533. ;;    string now changed.
  534. ;; 2) The Sysop can edit out the message once it has been rec'd.
  535. ;;           
  536.  
  537. Procedure ReadMail string MSGBASE
  538.   string toname,s
  539.   integer found,pos,filepos,len,i,more
  540.   savedmsg = FALSE 
  541.   chdir HOSTDIR
  542.   open MSGBASE 
  543.   if not success
  544.     Echo "^M^JSystem Error - no messages available at this time!^M^J"
  545.     print "SYSOP: Cannot find ",MSGBASE," file"
  546.     alarm "SYSOP: Cannot find MESSAGE file, disk full ?"
  547.     return
  548.   endif   
  549.   repeat
  550.   found = FALSE
  551.   read s
  552.   while success and not found      ; locate message 'To:' field
  553.     strpos s,"To     :",pos         
  554.     if pos>0 
  555.       substr s,pos+9,30,toname
  556.       if toname=username           ; username?
  557.         length toname,len          ; length of name
  558.         found = TRUE
  559.         msgread = TRUE       
  560.         tell filepos               ; save file position 
  561.         seek filepos-len-8         ; back to middle of 'To   :' string 
  562.         write "R",                 ; 'R'means message received
  563.       endif                        ; won't be shown on future  
  564.     endif                          ; logons - can be deleted by 
  565.     if not found                   ; Sysop
  566.       read s 
  567.     endif
  568.   endwhile
  569.   if found                       
  570.     i = 0  
  571.     mail = mail+1
  572.     seek filepos-90                ; start of message
  573.     EchoNormal
  574.     Echo "^M^J"
  575.     repeat
  576.       read s                       ; display message
  577.       Echo s
  578.       Echo "^M^J" 
  579.       more = TRUE
  580.       i = i+1
  581.       if i = 22 and more              
  582.         i = 0
  583.         Echo " More [y/N] "        ; pause if long message
  584.         InputChar ch
  585.         if ch = "^C" or ch = "N"
  586.           clear com
  587.           Echo "^M^J"
  588.           exit
  589.         endif
  590.         Echo "^M                    ^M"
  591.       endif  
  592.     until s = " End of Message"   ; end of message
  593.     EchoHilite
  594.     EchoColor SPECIALTEXTCOL
  595.     Echo "Continue [Y/n] "         ; read more mail?
  596.     InputEcho ch
  597.     if ch = "N"
  598.       success = FALSE
  599.     endif
  600.   endif
  601.   until not success
  602.   close
  603.   chdir TMDIR    
  604.   msgmail = TRUE
  605. Endproc  
  606.  
  607. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  608. ;; Changed record length in Checkuser routine, added expert menu
  609. ;; variable TRUE or FALSE for logon 'Menu Mode' and how many 
  610. ;; messages left for user.
  611. ;; Padded with spaces to provide for different password size
  612. ;; when changed by 'Change Password routine'.
  613. ;;
  614.  
  615. Procedure CheckUser string username,password,integer level,xpert,msgs,valid
  616.   integer found,pos1,pos2
  617.   string record,recordname,pass,lev,x,m
  618.   strpos username,";",pos1     ; record format: "first last;password#level
  619.   strpos username,"#",pos2     ;                  %xpert&msgs"
  620.     if pos1>0 or pos2>0 
  621.       valid = FALSE
  622.       return
  623.     endif
  624.   strpos password,";",pos1         ; check password for invalid character
  625.   strpos password,"#",pos2         ;  prevent "#2" etc
  626.     if pos1>0 or pos2>0
  627.       valid = FALSE
  628.       return
  629.     endif
  630.   chdir HOSTDIR
  631.   open "PASSWORD.HST"              ; passwords in PASSWORD.HST
  632.     if not success
  633.       create "PASSWORD.HST"
  634.     endif   
  635.       if not success
  636.         Echo "System error, please call again later^M^J"
  637.         print "SYSOP: Cannot create PASSWORD.HST"
  638.         Disconnect
  639.         alarm "SYSOP: Cannot create PASSWORD.HST, disk full ?"
  640.         return
  641.       endif 
  642.   found = FALSE
  643.   read record
  644.   while success and not found
  645.     strpos record,";",pos1         ; get fields from the record
  646.     strpos record,"#",pos2
  647.     if pos1>0 and pos2>0
  648.       substr record,1,pos1-1,recordname
  649.       substr record,pos1+1,pos2-pos1-1,pass
  650.       if recordname=username
  651.         found = TRUE
  652.           if pass=password
  653.             valid = TRUE
  654.             substr record,pos2+1,1,lev
  655.             atoi lev,level             ; get userlevel
  656.             substr record,pos2+3,1,x
  657.             atoi x,xpert               ; get menu mode
  658.             substr record,pos2+5,3,m
  659.             atoi m,msgs                ; how many personal messages
  660.           else
  661.             valid = FALSE
  662.           endif
  663.       endif
  664.     endif
  665.     if not found
  666.       read record
  667.     endif
  668.   endwhile
  669.   if not found                     ; new users
  670.     open "PASSWORD.HST"            ; else add new user
  671.     seek -1
  672.     write username,";",password,"#",NEWUSERLEVEL,"%",0,"&",0,"                                                                      " 
  673.  
  674.           ; user information record with extra spaces for 'password 
  675.           ; change' length and any further addition of variables 
  676.           ; at a later date. Field length - varies with length of
  677.           ; name or password, however 70 spaces at end
  678.  
  679.     usage "Newuser added to password file"
  680.     level = 1 
  681.     xpert = FALSE
  682.     valid = TRUE
  683.   endif
  684.   close
  685.   chdir TMDIR
  686. Endproc                             
  687.  
  688. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  689. ;; New Procedure WRITENEWRECORD
  690. ;; Routine to update PASSWORD.HST file for change of password, menu
  691. ;; mode status or 'add to' or 'take away' number of personal messages.
  692. ;;
  693. ;; ReadMail procedure adds number of messages read at logon,
  694. ;; Entermsg procedure sets addmsg to 1 which is added to msgs.
  695. ;;
  696. ;; rname =  'username' or 'name' for No. of personal messages 
  697. ;; Reads original record and then updates
  698. ;;
  699.  
  700. Procedure WriteNewRecord  string rname
  701.   integer found,filepos,len,pos1,pos2
  702.   string recordname,record,pass,lev,x,m                
  703.   chdir HOSTDIR
  704.   open "PASSWORD.HST"              
  705.   if not success
  706.     Echo "System error, please call again later^M^J"
  707.     print "SYSOP: Cannot locate PASSWORD.HST"
  708.     Disconnect
  709.     alarm "SYSOP: Cannot locate PASSWORD.HST, disk full ?"
  710.     return
  711.   endif
  712.   filepos = 0         
  713.   found = FALSE            
  714.   read record              
  715.   while success and not found      ; locate record
  716.     strpos record,";",pos1
  717.     strpos record,"#",pos2
  718.     if pos1>0 and pos2>0
  719.       substr record,1,pos1-1,recordname  ; locate name
  720.       substr record,pos1+1,pos2-pos1-1,pass
  721.       if recordname=rname               ; is it correct
  722.         found = TRUE                       
  723.         substr record,pos2+1,1,lev      ; get level etc
  724.         substr record,pos2+3,1,x
  725.         substr record,pos2+5,3,m
  726.         atoi m,msgs
  727.         if msgmail
  728.           msgs = msgs - mail
  729.         endif
  730.         if savedmsg  
  731.           msgs = msgs + addmsg
  732.         endif
  733.       endif
  734.     endif 
  735.     length record,len              ; find length of record
  736.     filepos = filepos+len+2        ; add 2 for carriage return
  737.     if not found                   ; and linefeed bytes
  738.       read record
  739.     endif
  740.   endwhile
  741.   if found             
  742.     seek filepos-len-2             ; write over record
  743.     if rname = username            ; logged on user? if another user,
  744.                                    ; keep record update messages
  745.       write rname,";",password,"#",userlevel,"%",xpert,"&",msgs,"                                                  ",
  746.     else
  747.       write rname,";",pass,"#",lev,"%",x,"&",msgs,"                                                   ",
  748.     endif                                            ;
  749.          ; it is important when editing password file 
  750.          ; that field length is kept 'as is'.
  751.          ; spaces are needed in case 'password' is shorter
  752.          ; than original when change of password made.
  753.  
  754.   endif
  755.   close      
  756.   chdir TMDIR    
  757.   msgmail = FALSE
  758. Endproc
  759.  
  760. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  761. ;; New Procedure ENTERMSG
  762. ;; addmsg variable increments number of personal messages 
  763. ;; being left to another user. Number of messages for user is checked
  764. ;; in PASSWORD.HST and updated by WriteNewRecord routine
  765. ;; Messages saved in a a message base file depends on MSBASE variable.
  766. ;; Updates number of messages at head of file.
  767. ;; End of message marker used to detect end of message when reading.
  768. ;; If replying to messages, To 'Name' entry is automatic,
  769. ;; optional same 'Subject'
  770. ;; Save and Kill message commands.
  771. ;; 
  772.  
  773. Procedure EnterMsg                     ; leave message
  774.   integer x,y,num,delpos,filepos       
  775.   integer msgnumber
  776.   string msg,str                       
  777.   filepos = 0                          
  778.   savedmsg = FALSE                     
  779.   clear text
  780.   clear com 
  781.   EchoClearScreen                  ; see screenio.scr
  782.   Echo "^M^J"
  783.   chdir HOSTDIR
  784.   open MSGBASE                     ; open message file
  785.   if not success                   ; e.g Message to Sysop
  786.       create MSGBASE
  787.   endif
  788.   if not success
  789.         Echo "System error, please call again later^M^J"
  790.         print "SYSOP: Cannot create ",MSGBASE," file"
  791.         Disconnect
  792.         alarm "SYSOP: Cannot create MESSAGE file, disk full ?"
  793.         return
  794.       endif  
  795.     read totalmsgs                 ; read number of existing messages
  796.     atoi totalmsgs,num             ; in message file, convert to an
  797.     msgnumber = num                ; integer to write new message No. 
  798.     EchoHilite
  799.     EchoBkColor HEADERBKCOL
  800.     EchoColor HEADERTEXTCOL 
  801.     Echo area                      ; display message base
  802.     Echo "......Press <Ctrl-Z> to End"
  803.     EchoBkColor GENBKCOL
  804.     Echo "^M^JFrom: "
  805.     Echo username
  806.     if MSGBASE = MSBASE0           ; if message to sysop
  807.       name = "Sysop"               ; put To Sysop
  808.       Echo "^M^J"
  809.     else
  810.       str = ""
  811.       Echo "^M^JTo: " 
  812.       EchoNormal 
  813.       if name = ""                 ; enter name of person to
  814.         InputString name           ; send message
  815.       else 
  816.        Echo name
  817.        Echo "^M^J"
  818.       endif
  819.       EchoHilite
  820.       EchoColor HEADERTEXTCOL
  821.     endif
  822.     if subject = ""                ; no subject?
  823.       Echo "Subject: (30 characters max.) " 
  824.       EchoNormal
  825.       InputString subject 
  826.     else  
  827.       Echo "Subject - Press [ENTER] for same or (S) for new subject: "
  828.       EchoNormal                   ; previous subject or new one?
  829.       InputEcho ch 
  830.       if ch = "^M" 
  831.         EchoHilite
  832.         EchoColor HEADERTEXTCOL
  833.         Echo "Subject: "       
  834.         EchoNormal
  835.         Echo subject               ; old subject
  836.       else
  837.         Echo "^M^J"
  838.         EchoHilite
  839.         EchoColor HEADERTEXTCOL
  840.         Echo "Subject: (30 characters max.) "
  841.         EchoNormal
  842.         InputString subject        ; new subject
  843.       endif
  844.       Echo "^M^J"
  845.     endif
  846.     msgnumber = msgnumber + 1      ; next message
  847.     seek filepos                   ; go to head of file
  848.     write msgnumber,"   ",         ; update number of messages
  849.     seek -1                        ; go to end of file 
  850.     tell delpos                    ; save file pointer for K)ill msg
  851.     write "^M^J                                   <-------->                                     " 
  852.     write " Msg#:",msgnumber 
  853.     write " From   : ",username
  854.     write " To     : ",name 
  855.     write " Date   : ",today,"  Time: ",now,"  Subject: ",subject  
  856.     write                          ; write header to file
  857.     tell filepos                   ; save file pointer to 
  858.     repeat                         ; control layout of message
  859.       InputEcho msg                ; get character
  860.       wherex x
  861.       if msg = " " and x>70
  862.         Echo "^M^J" 
  863.         msg = "^M^J "              ; space needed in message for
  864.         filepos = filepos+2        ; placement of linefeed character
  865.       else                         ; in file
  866.         if msg = "^H"              ; if backspace character, go back
  867.           filepos = filepos-1      ; 1 byte and write space
  868.           seek filepos
  869.           msg = " "
  870.         else
  871.           seek filepos             ; else go back and write character
  872.           filepos = filepos+1
  873.         endif
  874.         if msg = "^M"              ; if carriage return
  875.           msg = "^M^J"             ; linefeed in file
  876.           filepos = filepos+1
  877.         endif
  878.       endif
  879.       write msg,
  880.     until msg = "^Z"               ; end message
  881.     seek filepos-1                 ; write over end of file character
  882.     write "^M^J^M^J                                                  " 
  883.                                    ; record area for reply numbers
  884.     write " End of Message"       ; marker for read message routine
  885.     EchoHilite
  886.     EchoColor HEADERTEXTCOL
  887.     repeat     
  888.       Echo "^M^J^M^J S)ave or K)ill Message? "
  889.       InputEcho ch
  890.       if ch = "K"                  ; write over message
  891.         clear com
  892.         num = 0
  893.         seek delpos
  894.         read str
  895.         while success 
  896.           num = num+1
  897.           read str
  898.         endwhile
  899.         seek delpos                ; file position to delete from
  900.         write "^M^J"
  901.         while num>0
  902.           write ".........................................................................."
  903.           num = num-1              ; file can be edited later
  904.         endwhile
  905.         msgnumber = msgnumber-1    ; reduce message number
  906.         seek 0
  907.         write msgnumber,"   ",     ; spaces required in case of 10 -> 9 etc
  908.         Echo "^M^JMessage Deleted "
  909.         Save
  910.       elseif ch = "S"
  911.         clear com 
  912.         Echo "^M^JMessage Saved "
  913.         Save                 
  914.         If MSGBASE <> MSBASE0      ; if not Message to Sysop
  915.           addmsg = addmsg + 1               
  916.           savedmsg = TRUE          ; variables for WriteNewRecord
  917.         endif
  918.       endif
  919.     until ch = "S" or ch = "K"  
  920.     close 
  921.     chdir TMDIR
  922. Endproc
  923.  
  924. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  925. ;; New Procedure READMSG
  926. ;; S)can message headers, V)iew a selected message or press 
  927. ;; [ENTER] for next message, also can R)eply to message or Q)uit.
  928. ;; Total number of messages in selected message base displayed.
  929. ;; Keep 'Name' and 'Subject' for R)eply.
  930. ;; Number of replies to message shown as 'See Msg: #1, #2, #3 etc'.
  931. ;;
  932.  
  933. Procedure ReadMsg                  ; read messages
  934.   integer num,total,found,len,filepos,n,i,more,pos
  935.   string line1,line2,line3,line4,s,selnum,nextmsg
  936.  
  937.   Procedure ShowMsg                ; show message, used by V)iew
  938.     read s                         ; and [ENTER] for next message
  939.     while success and not found
  940.       strpos s,"Msg#:",pos         ; find message No.
  941.       if pos>0
  942.         substr s,pos+5,4,msgnum
  943.         if msgnum = selnum         ; correct message?
  944.           found = TRUE             
  945.         endif
  946.       endif
  947.       if not found                 ; no read next
  948.         read s
  949.       endif
  950.     endwhile                       
  951.     if found                       
  952.       i = 0            
  953.       name = "" 
  954.       subject = ""             
  955.       repeat
  956.         read s                     ; display message
  957.         strpos s,"From   :",pos 
  958.         if pos>0                   ; who entered message for reply
  959.           substr s,pos+9,30,name 
  960.         endif
  961.         strpos s,"Subject:",pos    ; get existing subject
  962.         if pos>0
  963.           substr s,pos+9,30,subject
  964.         endif
  965.         Echo s
  966.         Echo "^M^J" 
  967.         more = TRUE
  968.         i = i+1
  969.         if i = 22 and more              
  970.           i = 0
  971.           Echo " More [y/N] "       ; pause if long message
  972.           InputChar ch
  973.           if ch = "^C" or ch = "N"
  974.             clear com
  975.             Echo "^M^J"
  976.             exit
  977.           endif
  978.           Echo "^M                    ^M"
  979.         endif  
  980.       until s = " End of Message"   ; end of message
  981.       EchoHilite
  982.       EchoColor HEADERTEXTCOL
  983.       Echo "^M^JR)eply ? or [ENTER] to continue "  ; reply to message?
  984.       InputEcho ch
  985.       repeat                    
  986.         if ch = "R"
  987.           clear com
  988.           n = total+1              
  989.           itoa n,nextmsg           ; next message number for reply field
  990.           tell filepos
  991.           seek filepos-70          ; start of reply number field
  992.           read s
  993.           strpos s, "See Msg:",pos ; check for earlier reply
  994.           if pos>0                  
  995.             strpos s,"    ",pos    ; yes locate spaces
  996.             if pos > 2             ; i.e. after See Msg #
  997.               length s,len         ; find toal length including spaces
  998.               strdel s,pos,len-pos+1 ; delete spaces
  999.               concat s,", "        ; add comma
  1000.               concat s,nextmsg     ; add next reply message number
  1001.               seek filepos-70      ; head of field
  1002.               write s,             
  1003.             endif
  1004.           else                     ; empty string (all spaces)
  1005.             seek filepos-70        ; head of record
  1006.             write "  See Msg: ",n, ; message number of first reply
  1007.           endif
  1008.            reply = TRUE            ; for return to message base
  1009.            addmsg = 0
  1010.            EnterMsg
  1011.            WriteNewRecord name     ; update mail
  1012.         else                       
  1013.           clear com
  1014.           exit
  1015.         endif
  1016.       until ch = "R" or ch = "^M"
  1017.     endif
  1018.   Endproc
  1019.  
  1020.   clear com                        ; main routine
  1021.   clear text
  1022.   EchoClearScreen  
  1023.   reply = FALSE
  1024.   num = 0
  1025.   pos = 0
  1026.   chdir HOSTDIR
  1027.   open MSGBASE 
  1028.   if not success
  1029.     Echo "^M^JSorry no messages available at this time!^M^J"
  1030.     print "SYSOP: Cannot find ",MSGBASE," file"
  1031.     alarm "SYSOP: Cannot find MESSAGE file, disk full ?"
  1032.     return
  1033.   endif            
  1034.   while success 
  1035.     clear text
  1036.     clear com
  1037.     seek 0                         ; go to head of file 
  1038.     read totalmsgs                 ; get total No. of messages
  1039.     atoi totalmsgs,total
  1040.     EchoClearScreen
  1041.     EchoHilite
  1042.     EchoColor HEADERTEXTCOL
  1043.     Echo " Number of Messages : "  ; display number of messages
  1044.     Echo totalmsgs
  1045.     Echo "^M^J S)can   Q)uit   V)iew  or [ENTER] for next msg : "
  1046.     InputEcho ch
  1047.     Echo "^M^J^M^J"        
  1048.     switch ch    
  1049.       case "S":                    ; scan through messages 
  1050.           EchoNormal
  1051.           i = 0 
  1052.           while success
  1053.             read line1             ; start at line 1
  1054.             strpos line1,"Msg#:",pos ; and locate message No. line
  1055.             if pos > 0 
  1056.               read line2
  1057.               read line3 
  1058.               read line4
  1059.               Echo line1           ; show header of message
  1060.               Echo "^M^J"
  1061.               Echo line2 
  1062.               Echo "^M^J"
  1063.               Echo line3
  1064.               Echo "^M^J"
  1065.               Echo line4
  1066.               Echo "^M^J^M^J"
  1067.               i = i + 5
  1068.             endif
  1069.             more = TRUE
  1070.             if i >= 20 and more    ; pause if more messages        
  1071.               i = 0
  1072.               Echo " More [y/N] "
  1073.               InputChar ch
  1074.               if ch = "^C" or ch = "N"
  1075.                 clear com
  1076.                 Echo "^M^J"
  1077.                 exit
  1078.               endif
  1079.               Echo "^M                    ^M"
  1080.             endif  
  1081.           endwhile  
  1082.           Pause 
  1083.       case "Q":                    ; quit message base    
  1084.         close
  1085.         chdir TMDIR  
  1086.         return                       
  1087.       case "^M":                   ; [ENTER] for next message
  1088.         num = num + 1              ; increment to next message
  1089.         if num > total             ; last message? 
  1090.           EchoHilite
  1091.           Echo HEADERTEXTCOL
  1092.           Echo "^M^JThere are no more messages"
  1093.           delay 10
  1094.         else                       ; else show message
  1095.           EchoNormal     
  1096.           found = FALSE 
  1097.           itoa num,selnum          
  1098.           Echo "Msg#: "
  1099.           Echo selnum
  1100.           Echo "^M^J"
  1101.           ShowMsg
  1102.           if reply
  1103.             return
  1104.           endif
  1105.         endif
  1106.       case "V":                    ; view message
  1107.         Echo "^M^JMsg No.? "
  1108.         Inputstring selnum         ; select number of message
  1109.         atoi selnum,num 
  1110.         EchoColor HILITECOL
  1111.         if num > total  or num = 0 ; check validity of selection No.
  1112.           print "^M^JThere are ",totalmsgs," messages only!!!"
  1113.           delay 10
  1114.         else
  1115.           EchoNormal     
  1116.           found = FALSE 
  1117.           Echo "^M^J"
  1118.           seek 6                   ; up to 5 figures (total msgs)
  1119.           ShowMsg                  ; show message
  1120.           if reply
  1121.             return
  1122.           endif
  1123.         endif
  1124.     endswitch
  1125.   endwhile
  1126.   close         
  1127.   chdir TMDIR
  1128. Endproc
  1129.  
  1130.  
  1131. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1132. ;; New Procedure ACCESSMSG
  1133. ;; Allows access to Message Areas, keeps selection 
  1134. ;; Only displays configured message areas.
  1135. ;; Once selected can R)ead, E)nter or Q)uit, ? for help
  1136. ;;                                                     
  1137.  
  1138. Procedure AccessMsg                ; message area listing 
  1139.    string a
  1140.    integer c,n,quit
  1141.    c = 1
  1142.    clear com 
  1143.    clear key
  1144.    clear text
  1145.    EchoClearScreen
  1146.    EchoHilite
  1147.    EchoColor SPECIALTEXTCOL         
  1148.    Echo "^M^J                           ┌───────────────────────┐^M^J"
  1149.    Echo "                           │ Message Area Listings │^M^J" 
  1150.    Echo "                           └───────────────────────┘^M^J"      
  1151.    EchoNormal 
  1152.    while c < COUNT+1               ; only display areas as read
  1153.      switch c                      ; from TMHCFG.HST
  1154.        case 1:   
  1155.          Echo "^M^J                          1.  "
  1156.          Echo area0 
  1157.        case 2:
  1158.          Echo "^M^J                          2.  " 
  1159.          Echo area1 
  1160.        case 3:
  1161.          Echo "^M^J                          3.  "
  1162.          Echo area2 
  1163.        case 4:
  1164.          Echo "^M^J                          4.  "
  1165.          Echo area3
  1166.        case 5:
  1167.          Echo "^M^J                          5.  " 
  1168.          Echo area4   
  1169.        case 6:
  1170.          Echo "^M^J                          6.  "
  1171.          Echo area5 
  1172.        case 7:
  1173.          Echo "^M^J                          7.  "
  1174.          Echo area6
  1175.        case 8:
  1176.          Echo "^M^J                          8.  " 
  1177.          Echo area7
  1178.        case 9:
  1179.          Echo "^M^J                          9.  "
  1180.          Echo area8
  1181.        case 10:
  1182.          Echo "^M^J                          10. "
  1183.          Echo area9 
  1184.      endswitch 
  1185.      c = c+1
  1186.    endwhile
  1187.    n = areanum                     ; save area number 
  1188.    Echo "^M^J^M^JSelect Area Number desired, press [Enter]: "
  1189.    EchoHilite 
  1190.    InputString a 
  1191.    atoi a,areanum
  1192.    if areanum > COUNT
  1193.      Echo "^M^JArea NOT available!!"
  1194.      areanum = n                   ; original areanum
  1195.      delay 10                       
  1196.      return
  1197.    else                            ; once selected
  1198.      switch areanum                ; setup message base and 
  1199.        Case 1:                     ; appropriate file
  1200.          MSGBASE = MSBASE0
  1201.          area = area0
  1202.          areanum = 1               ; command line area number   
  1203.        Case 2:
  1204.          MSGBASE = MSBASE1
  1205.          area = area1
  1206.          areanum = 2                  
  1207.        Case 3: 
  1208.          MSGBASE = MSBASE2
  1209.          area = area2 
  1210.          areanum = 3                  
  1211.        Case 4:
  1212.          MSGBASE = MSBASE3
  1213.          area = area3
  1214.          areanum = 4                  
  1215.        Case 5:
  1216.          MSGBASE = MSBASE4
  1217.          area = area4
  1218.          areanum = 5                  
  1219.        Case 6: 
  1220.          MSGBASE = MSBASE5
  1221.          area = area5 
  1222.          areanum = 6                  
  1223.        Case 7:
  1224.          MSGBASE = MSBASE6
  1225.          area = area6
  1226.          areanum = 7                  
  1227.        Case 8: 
  1228.          MSGBASE = MSBASE7
  1229.          area = area7
  1230.          areanum = 8                  
  1231.        Case 9:
  1232.          MSGBASE = MSBASE8
  1233.          area = area8 
  1234.          areanum = 9                  
  1235.        Case 10:
  1236.          MSGBASE = MSBASE9
  1237.          area = area9
  1238.          areanum = 10                  
  1239.      endswitch   
  1240.      quit = FALSE
  1241.      while not quit
  1242.        EchoClearScreen
  1243.        EchoHilite
  1244.        EchoColor SPECIALTEXTCOL
  1245.        Echo "^M^J^M^JMESSAGE AREA - "
  1246.        Echo area 
  1247.        Echo "^M^JE)nter   R)ead   Q)uit ( ? for commands):" 
  1248.        InputEcho ch
  1249.        switch ch
  1250.          Case "E":                 ; Enter a message
  1251.            name = ""
  1252.            subject = ""
  1253.            addmsg = 0
  1254.            EnterMsg
  1255.            WriteNewRecord name
  1256.          Case "R":                 ; read message  
  1257.            if MSGBASE = MSBASE0    ; message to sysop
  1258.              If userlevel = SYSOPLEVEL  ; read by sysop only
  1259.                ReadMsg
  1260.              else
  1261.                Echo "^M^J^M^JThese are PRIVATE messages!"
  1262.                delay 10 
  1263.              endif
  1264.            else
  1265.              ReadMsg               ; other areas
  1266.            endif                     
  1267.          Case "?":                 ; show available commands
  1268.            EchoNormal
  1269.            Echo "^M^J^M^JE)nter Messages --> S)ave or K)ill"
  1270.            Echo "^M^JR)ead Messages  --> S)can  Q)uit  V)iew  or" 
  1271.            Echo "^M^J                --> [ENTER] for next Message" 
  1272.            Echo "^M^J                --> Msg# and/or R)eply"
  1273.            Echo "^M^JQ)uit           --> Quit message base"
  1274.            Echo "^M^J?               --> This help screen^M^J^M^J"
  1275.            Pause
  1276.          Case "Q":
  1277.            quit = TRUE
  1278.        endswitch        
  1279.      endwhile 
  1280.    endif
  1281. Endproc
  1282.  
  1283. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1284. ;; New Procedure TRASH
  1285. ;; Checks for bad passwords in TRASHCAN.HST
  1286. ;; Sysop edited file - just add passwords not to be accepted
  1287. ;; by system
  1288. ;;
  1289.  
  1290. Procedure Trash                    ; test for bad passwords
  1291.   string s
  1292.   chdir HOSTDIR
  1293.   open "TRASHCAN.HST"              ; trash password file
  1294.   if not success
  1295.     Echo "System error, please call again later^M^J"
  1296.     print "SYSOP: Cannot open TRASHCAN.HST"
  1297.     Disconnect
  1298.     alarm "SYSOP: Cannot open TRASHCAN.HST, disk full ?"
  1299.     return
  1300.   endif
  1301.   while success
  1302.     read s                         ; read word
  1303.     if password = s                ; if password trash, hangup
  1304.       access = FALSE
  1305.     endif  
  1306.   endwhile
  1307.   close 
  1308.   chdir TMDIR
  1309. Endproc
  1310.                                               
  1311. Procedure Directory                ; display download directory
  1312.   string cmd
  1313.   cmd = "DIR >"
  1314.   clear com
  1315.   clear text
  1316.   concat cmd,FILEDIR               ; DIR >\HOST.DIR
  1317.   dos cmd                          ; shell to DOS
  1318.   TypeFile FILEDIR,TRUE            ; display \HOST.DIR
  1319. Endproc
  1320.                                        
  1321. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1322. ;; Addition of Bimodem to Protocol selection.
  1323. ;;
  1324.  
  1325. Procedure Bimod                    ; bimodem transfer
  1326.   clear text
  1327.   clear com 
  1328.   EchoColor GENTEXTCOL
  1329.   Echo "Set-up YOUR end NOW........I am Ready for the transfer.^M^J"
  1330.   Echo "When your end prompts to start my end: press [ENTER]..."
  1331.    InputEcho ""
  1332.    dos "BIMODEM /B 2400 "
  1333.    clear text
  1334.    dos "del Bimodem.Pth"
  1335.    alarm " * Bimodem Transfer(s) Completed * "
  1336.    Echo "^M^J ** Bimodem Transfer Completed ** "
  1337. Endproc
  1338.  
  1339. Procedure FileTransfer string mode,protocol,filename
  1340.   print "^M^JPlease start your transfer procedure or press Ctrl-X to abort^M^J"
  1341.     if mode = "r"
  1342.       if filename=""               ; receive batch files
  1343.         receive protocol
  1344.       else
  1345.         receive protocol,filename  ; receive single file
  1346.       endif
  1347.     else
  1348.       send protocol,filename       ; send multiple files
  1349.     endif       
  1350.     clear com
  1351.     if success
  1352.       Echo "File transfer completed!^M^J"
  1353.     else
  1354.       Echo "File transfer aborted!^M^J"
  1355.     endif
  1356.     Pause
  1357. Endproc
  1358.  
  1359. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1360. ;; New Procedure QUESTIONNAIRE
  1361. ;; Newuser fills out questionnaire, saved to file USER.HST.
  1362. ;; Keep list of users, can be edited if status changes.
  1363. ;;                                                    
  1364.  
  1365. Procedure Questionnaire            ; new users file
  1366.   string address,suburb,city,pcode,modemnum,phonenum,check
  1367.   integer filepos
  1368.   clear com
  1369.   clear text 
  1370.   EchoColor GENTEXTCOL
  1371.   repeat
  1372.   If userlevel < NUSERLEVEL
  1373.     Echo "^M^J You are not found in the user file.^M^J"
  1374.   endif
  1375.   Echo " Would you like to register? [Y/n] : "
  1376.     InputEcho ch
  1377.     if ch = "Y"                          
  1378.       clear com
  1379.       clear text
  1380.       EchoClearScreen
  1381.       EchoHilite
  1382.       EchoColor SPECIALTEXTCOL
  1383.       Echo "^M^J                       ┌────────────────────────────┐^M^J"
  1384.       Echo "                       │ Registration Questionnaire │^M^J" 
  1385.       Echo "                       └────────────────────────────┘^M^J"      
  1386.       chdir HOSTDIR
  1387.       open "USER.HST"              ; user information file
  1388.       if not success
  1389.         create "USER.HST"
  1390.       endif   
  1391.       if not success
  1392.         Echo "System error, please call again later^M^J"
  1393.         print "SYSOP: Cannot create USER.HST"
  1394.         Disconnect
  1395.         alarm "SYSOP: Cannot create USER.HST, disk full ?"
  1396.         return
  1397.       endif
  1398.       seek -1
  1399.       write "**** NEW USER *****"
  1400.       write "NAME:     ",username 
  1401.       tell filepos
  1402.       write "PASSWORD: ",password,"                "
  1403.       write "LEVEL:    ",userlevel
  1404.       repeat
  1405.         Echo "^M^JWhat is your street address ?"
  1406.         Echo "^M^J--->"
  1407.         InputString address
  1408.         Echo address
  1409.         Echo " [y/N] "
  1410.         InputEcho check
  1411.         if check = "N"
  1412.           address = ""
  1413.         endif
  1414.       until check = "Y"
  1415.       write "ADDRESS:  ",address 
  1416.       repeat
  1417.         Echo "^M^J^M^JWhat is your Suburb ? --> "
  1418.         InputString suburb
  1419.         Echo suburb
  1420.         Echo " [y/N] "
  1421.         InputEcho check
  1422.         if check = "N"
  1423.           suburb = ""
  1424.         endif
  1425.       until check = "Y"
  1426.       write "SUBURB:   ",suburb 
  1427.       repeat
  1428.         Echo "^M^J^M^JWhat City are you calling from ? --> "
  1429.         InputString city
  1430.         Echo city
  1431.         Echo " [y/N] "
  1432.         InputEcho check
  1433.         if check = "N"
  1434.           city = ""
  1435.         endif
  1436.       until check = "Y"
  1437.       write "CITY:     ",city
  1438.         repeat
  1439.         Echo "^M^J^M^JWhat is your post code ? --> "
  1440.         InputString pcode
  1441.         Echo pcode
  1442.         Echo " [y/N] "
  1443.         InputEcho check
  1444.         if check = "N"
  1445.           pcode = ""
  1446.         endif
  1447.       until check = "Y"
  1448.       write "POSTCODE: ",pcode
  1449.       repeat
  1450.         Echo "^M^J^M^JModem No. ? --> "
  1451.         InputString modemnum
  1452.         Echo modemnum
  1453.         Echo " [y/N] "
  1454.         InputEcho check
  1455.         if check = "N"
  1456.           modemnum = ""
  1457.         endif
  1458.       until check = "Y" 
  1459.       write "MODEM No. ",modemnum
  1460.       repeat
  1461.         Echo "^M^J^M^JVoice phone No. ? --> "
  1462.         InputString phonenum
  1463.         Echo phonenum
  1464.         Echo " [y/N] "
  1465.         InputEcho check
  1466.         if check = "N"
  1467.           phonenum = ""
  1468.         endif
  1469.       until check = "Y"
  1470.       write "PHONE No. ",phonenum
  1471.       write "^M^J───────────────────────────────────────────────────────────────────────────────" 
  1472.       repeat
  1473.         Echo "^M^J^M^JPick a password (4 - 16 characters max): "
  1474.         Echo "^M^J--->"
  1475.         InputString password
  1476.         Echo password
  1477.         Echo " [y/N] "
  1478.         InputEcho check
  1479.         if check = "N"
  1480.           password = ""
  1481.         endif
  1482.       until check = "Y" 
  1483.       seek filepos                 ; update password
  1484.       write "PASSWORD: ",password,
  1485.       close
  1486.       chdir TMDIR 
  1487.       clear com
  1488.       clear text
  1489.       Echo "^M^JRegistration information saved " 
  1490.       Save
  1491.       Echo "^M^J^M^JThankyou for filling out the questionnaire.^M^J^M^J"
  1492.       Usage "User filled out Questionnaire......"
  1493.       if userlevel < NUSERLEVEL
  1494.         Echo "If you have provided the correct information, you^M^J"
  1495.         Echo "will be elevated to User STATUS within a day or so.^M^J^M^J^M^J"
  1496.       endif
  1497.       Pause
  1498.     else                                   
  1499.       exit
  1500.     endif
  1501.     Echo "^M^J"
  1502.   until ch = "Y" or ch = "N"       ; repeat until either Y/N   
  1503. Endproc
  1504.  
  1505. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1506. ;; New Procedure WELCOMEUSER
  1507. ;; welcome user after logon, show time, date and No. of personal
  1508. ;; messages.
  1509. ;; choice of reading personal messages at logon
  1510.  
  1511. Procedure WelcomeUser
  1512.   string wname,message 
  1513.   integer len,c,pos
  1514.   c = 1
  1515.   time now
  1516.   strdel now,6,3
  1517.   wname = username
  1518.   length wname,len 
  1519.   strpos wname," ",pos
  1520.   if pos>0                         ; welcome user by
  1521.     strdel wname,pos+1,len-pos     ; first name 
  1522.   endif
  1523.   EchoClearScreen
  1524.   EchoHilite
  1525.   EchoColor SPECIALTEXTCOL
  1526.   Echo "^M^J^M^JHello "
  1527.   EchoColor HILITECOL
  1528.   Echo wname
  1529.   EchoColor SPECIALTEXTCOL
  1530.   Echo "welcome to the "
  1531.   Echo TMHOST
  1532.   print "^M^J^M^JThe time is ",now," on",wdate   ; show time and date
  1533.   put "^M^J^M^JThe time is ",now," on",wdate
  1534.   if msgs = 0                                    ; any mail?
  1535.     Echo "^M^JSorry there is no mail for you today"
  1536.   else 
  1537.     if msgs > 1                    ; yes, show how many
  1538.       message = " messages "
  1539.       print "^M^JYou have ",msgs," personal",message,"to read"
  1540.       put "^M^JYou have ",msgs," personal",message,"to read"
  1541.     else 
  1542.       message = " message "
  1543.       print "^M^JYou have ",msgs," personal",message,"to read"
  1544.       put "^M^JYou have ",msgs," personal",message,"to read"
  1545.     endif
  1546.     Echo "^M^J^M^JRead personal mail [Y/n] "   ; offer choice
  1547.     InputEcho ch                               ; to read mail
  1548.     if ch = "Y"  
  1549.       mail = 0
  1550.       msgread = FALSE 
  1551.       while c < COUNT+1            ; check  all available
  1552.         switch c                   ; message areas
  1553.           case 1:
  1554.             Echo "^M^JMessage area 1 - "
  1555.             Echo area0
  1556.             ReadMail MSBASE0
  1557.           case 2:
  1558.             Echo "^M^JMessage area 2 - "
  1559.             Echo area1
  1560.             ReadMail MSBASE1
  1561.           case 3:
  1562.             Echo "^M^JMessage area 3 - "
  1563.             Echo area2
  1564.             ReadMail MSBASE2
  1565.           case 4:      
  1566.             Echo "^M^JMessage area 4 - "
  1567.             Echo area3
  1568.             ReadMail MSBASE3
  1569.           case 5:
  1570.             Echo "^M^JMessage area 5 - "
  1571.             Echo area4
  1572.             ReadMail MSBASE4
  1573.           case 6:
  1574.             Echo "^M^JMessage area 6 - "
  1575.             Echo area5
  1576.             ReadMail MSBASE5
  1577.           case 7:
  1578.             Echo "^M^JMessage area 7 - "
  1579.             Echo area6
  1580.             ReadMail MSBASE6
  1581.           case 8: 
  1582.             Echo "^M^JMessage area 8 - "
  1583.             Echo area7
  1584.             ReadMail MSBASE7
  1585.           case 9:
  1586.             Echo "^M^JMessage area 9 - "
  1587.             Echo area8
  1588.             ReadMail MSBASE8
  1589.           case 10:
  1590.             Echo "^M^JMessage area 10 - "
  1591.             Echo area9
  1592.             ReadMail MSBASE9
  1593.         endswitch 
  1594.         c = c+1
  1595.       endwhile
  1596.       if msgread
  1597.        Echo "^M^JEnd of personal messages"   
  1598.       endif
  1599.       WriteNewRecord username      ; update record (msgs left)
  1600.     endif                          ; 0 if read all msgs
  1601.   endif
  1602.   Echo "^M^J^M^J"
  1603.   EchoNormal
  1604.   Pause
  1605. Endproc
  1606.  
  1607. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1608. ;; Modified WaitForCall procedure with ANSI variable ANSIREMOTE
  1609. ;; to detect use of Ansi Graphics at logon.
  1610. ;; Beefed up password checking routine, e.g. look for rubbish
  1611. ;; passwords, too may attempts at password.
  1612. ;; Set time on line variable depending on user level.
  1613. ;;
  1614.  
  1615. Procedure WaitForCall              ; wait for connected
  1616.   integer i,len,valid,exist,baudrate
  1617.   set connection,modem
  1618.   LOCAL = FALSE
  1619.   xpert = FALSE
  1620.   while not connected              ; wait for carrier signal
  1621.     inputch ch                     ; sysop commands
  1622.       if success
  1623.         switch ch
  1624.           case "^[":               ; abort
  1625.             HostEnd
  1626.           case "L":                ; local mode
  1627.             set connection,computer  ; this will set connected = 1
  1628.             LOCAL = TRUE
  1629.           case "C":                ; configuration
  1630.             script "TMHCFG"        ; chain to TMHCFG.SCR
  1631.         endswitch
  1632.       endif
  1633.   endwhile
  1634.   if not LOCAL and DETECTBAUD
  1635.     waitfor "CONNECT^M","CONNECT 1200","CONNECT 2400","CONNECT 9600","CONNECT 19200",10
  1636.     if found
  1637.       switch found
  1638.         case 1: baudrate = 300
  1639.         case 2: baudrate = 1200
  1640.         case 3: baudrate = 2400
  1641.         case 4: baudrate = 9600
  1642.         case 5: baudrate = 19200
  1643.       endswitch
  1644.       set baud,baudrate
  1645.       Echo "Connected at "
  1646.       if not LOCAL
  1647.         put baudrate,"^M^J"
  1648.       endif
  1649.       print baudrate
  1650.     endif
  1651.   endif
  1652.   Echo "^M^J"
  1653.   delay 5
  1654.   clear com
  1655.   clear text
  1656.   delay 5
  1657.   EchoNormal
  1658.   chdir HOSTDIR
  1659.   TypeFile "WELCOME.HST",FALSE     ; display welcome message
  1660.   repeat
  1661.     Echo "Does your Terminal support ANSI Graphics Y/N ?: "
  1662.     InputEcho ch
  1663.     if ch = "Y"
  1664.       ANSIREMOTE = TRUE            ; for ansi display to remote
  1665.     else                           
  1666.       ANSIREMOTE = FALSE
  1667.     endif
  1668.       Echo "^M^J"
  1669.   until ch = "Y" or ch = "N"       ; repeat until either Y/N           
  1670.   chdir TMDIR
  1671.   i = 1
  1672.   len = 0
  1673.   username = ""                    ; enter name (at most 3 times)
  1674.   while i<=3 and len<4 and connected
  1675.     EchoColor GENTEXTCOL
  1676.     Echo "Please enter your First and Last name: "
  1677.     EchoHilite
  1678.     EchoColor HILITECOL
  1679.     InputString username
  1680.     i = i+1
  1681.     length username,len            ; check the length of name
  1682.     if len<4
  1683.       Echo "Name too short, please try again^M^J^M^J"
  1684.     else
  1685.       EchoNormal
  1686.       EchoColor GENTEXTCOL
  1687.       Echo username
  1688.       Echo " [Y/n]? "
  1689.       EchoHilite
  1690.       EchoColor HILITECOL
  1691.       InputString ch
  1692.       if ch="n"
  1693.         len=0
  1694.       endif
  1695.     endif
  1696.   endwhile
  1697.   if len<4 and connected
  1698.     Echo "Goodbye^M^J"
  1699.     Disconnect
  1700.     Usage "User disconnected - name too short"
  1701.   else 
  1702.     i = 1
  1703.     len = 0
  1704.     password = ""                  ; enter password (at most 3 times)
  1705.     while i<=3 and len<4 and connected
  1706.       EchoNormal
  1707.       EchoColor GENTEXTCOL
  1708.       Echo "Password: "
  1709.       EchoHilite
  1710.       EchoColor HILITECOL
  1711.       InputPassword password
  1712.       Trash
  1713.         if not access 
  1714.           Echo "^M^JGarbage Passwords not accepted, access denied!^M^J" 
  1715.           Disconnect
  1716.           Usage "User not accepted - garbage password!"
  1717.           return
  1718.         endif
  1719.       i = i+1
  1720.       length password,len          ; check the length of password
  1721.       if len<4
  1722.         Echo "Password too short, please try again^M^J^M^J"
  1723.       endif 
  1724.     endwhile
  1725.     if len>=4                     ; check password and get user level
  1726.       i = 1
  1727.       while i<=3
  1728.         CheckUser username,password,userlevel,xpert,msgs,valid  
  1729.         if not valid              ; check validity, 3 attempts
  1730.           Echo "Does not match password on file, try again : " 
  1731.           InputPassword password
  1732.         endif 
  1733.         i = i+1
  1734.       endwhile
  1735.     endif
  1736.     if len<4 and connected         ; length wrong, disconnect
  1737.       Echo "Invalid password, access denied^M^J^M^J"
  1738.       Disconnect
  1739.       return  
  1740.       Usage "User disconnected - invalid password"
  1741.     endif
  1742.     if not valid and connected     ; not valid, disconnect
  1743.       Echo "Too many attempts, access denied^M^J^M^J"
  1744.       Disconnect
  1745.       return
  1746.       Usage "User disconnected - Too many attempts at password"
  1747.     else
  1748.       if userlevel = SYSOPLEVEL    ; set logon time
  1749.         ontime = 60
  1750.       elseif userlevel = NUSERLEVEL
  1751.         ontime = 30
  1752.       elseif userlevel < NUSERLEVEL
  1753.         ontime = 20
  1754.         Questionnnaire
  1755.       endif 
  1756.       usage "Logon by:"
  1757.       usage username 
  1758.       time logontime               ; time at user's logon
  1759.       EchoNormal
  1760.       clear com
  1761.       clear text
  1762.       chdir HOSTDIR                ; display notice
  1763.       FileExist "HNOTICE.HST",exist
  1764.       if exist
  1765.         Echo "^M^J"
  1766.         TypeFile "HNOTICE.HST",TRUE
  1767.       endif
  1768.     endif
  1769.   endif 
  1770.   chdir TMDIR
  1771.   WelcomeUser
  1772. Endproc
  1773.  
  1774. Procedure ChatMode                 ; chat mode
  1775.   integer x
  1776.   string rch,lch
  1777.   Echo "^M^JChat mode begin:^M^J"
  1778.   repeat
  1779.     if not LOCAL
  1780.       getch rch
  1781.       if success
  1782.         put rch,
  1783.         if rch = "^M"              ; line feed
  1784.           Echo "^J"
  1785.         endif
  1786.         wherex x
  1787.           if rch = " " and x > 70
  1788.             Echo "^M^J"
  1789.           endif
  1790.       endif
  1791.     endif
  1792.     inputch lch
  1793.     if success and lch<>"^["       ; abort if sysop press [Esc]
  1794.       Echo lch
  1795.       if lch = "^M"
  1796.         Echo "^J"
  1797.       endif
  1798.       wherex x
  1799.       if lch = " " and x > 70
  1800.         Echo "^M^J"
  1801.       endif
  1802.     endif
  1803.   until lch="^[" or not connected
  1804.   Echo "^M^JChat mode end.^M^J^M^J"
  1805.   Pause
  1806. Endproc 
  1807.  
  1808. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1809. ;; New Procedure STATISTICS
  1810. ;; Shows user statistics and enables change of 'Password' or 'Menu Mode'.
  1811. ;;                                
  1812.  
  1813. Procedure Statistics               ; view statistics and 
  1814.   integer len                      ; change password choice
  1815.   clear com
  1816.   clear text 
  1817.   EchoClearScreen
  1818.   EchoColor HILITECOL
  1819.   Echo "^M^J" 
  1820.   Echo username 
  1821.   Echo " - your statistics are:^M^J"
  1822.   EchoColor GENTEXTCOL    
  1823.   Echo "For this call you have "
  1824.   print timeleft,                  ; integers 
  1825.   put timeleft,
  1826.   Echo " minutes remaining.^M^J"
  1827.   Echo "Userlevel: " 
  1828.   if userlevel = 1                 ; show statistics
  1829.     Echo "New User" 
  1830.   elseif userlevel = 2
  1831.     Echo "Normal User"
  1832.   elseif userlevel = 3
  1833.     Echo "Priviledged User"
  1834.   endif
  1835.   Echo "^M^JMenu Mode: "
  1836.   if xpert
  1837.     Echo "Expert (No Menus)"
  1838.   else
  1839.     Echo "Full Menus"
  1840.   endif
  1841.   Echo  "^M^JYour password is: "
  1842.   Echo password 
  1843.   Echo "^M^J^M^J"
  1844.   len = 0
  1845.   EchoNormal
  1846.   EchoHilite        
  1847.   Echo "Change Password ? [y/n] "
  1848.   InputEcho ch
  1849.   if ch = "Y"
  1850.     while len<4  
  1851.       Echo "^M^JNew Password: " 
  1852.       EchoNormal
  1853.       InputPassword password
  1854.       Trash
  1855.       if not access 
  1856.         EchoHilite
  1857.         Echo "^M^JGarbage Passwords not accepted, access denied!^M^J" 
  1858.         Disconnect
  1859.         Usage "User not accepted - garbage password!"
  1860.         return
  1861.       endif
  1862.       length password,len          ; check the length of password
  1863.       if len<4
  1864.         Echo "Password too short, please try again^M^J"
  1865.       else
  1866.         WriteNewRecord username
  1867.         Echo "^M^J^M^JNew Password saved "
  1868.         Save
  1869.         Echo "^M^JWrite it down, it is your new logon password!^M^J^M^J"
  1870.       endif
  1871.     endwhile
  1872.   else
  1873.     EchoNormal
  1874.     Echo "^M^JOriginal Password valid............^M^J^M^J"
  1875.   endif
  1876.   EchoHilite
  1877.   Echo "^M^JIf you have changed your 'Menu Mode' since" 
  1878.   Echo "^M^Jlogging on it can be saved for future logons."
  1879.   Echo "^M^JSave ? [y/n] "
  1880.   EchoNormal
  1881.   InputEcho ch
  1882.   if ch = "Y"
  1883.     WriteNewRecord username        ; update record
  1884.     Echo "^M^JMenu Mode Saved "
  1885.   Save
  1886.   endif 
  1887.   Echo "^M^J^M^J"
  1888.   Pause
  1889. Endproc
  1890.  
  1891. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1892. ;; New Procedure TIMEUP 
  1893. ;; Warns then disconnects user if out of time.
  1894. ;;
  1895.  
  1896. Procedure Timeup                   ; disconnect if over time
  1897.   if timeleft <= 3
  1898.     EchoHilite
  1899.     at 2,20                        ; warning
  1900.     Echo "WARNING - disconnection imminent!"
  1901.     EchoNormal
  1902.   endif
  1903.   if timeleft = 0
  1904.     EchoHilite
  1905.     Echo "^M^JOut of Time.  Connection Terminated^M^J"
  1906.     Disconnect
  1907.     Usage "User disconnected - out of  time"
  1908.   endif  
  1909. Endproc 
  1910.   
  1911. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1912. ;; Modified DoCommand procedure for control of 'Menu mode',
  1913. ;; Ansi menus, calculation of time on, etc.
  1914. ;;
  1915.  
  1916. Procedure DoCommand                ; do a command
  1917.   integer pos
  1918.   clear com
  1919.   clear text
  1920.   time now                         ; current time
  1921.   strdel now,6,3
  1922.   CalcTime logontime,now,mins      ; compare times
  1923.   timeleft = ontime - mins         ; time left online
  1924.   if ANSIREMOTE
  1925.     if xpert                       ; expert mode      
  1926.       Timeup    
  1927.       EchoClearScreen 
  1928.       LocalView
  1929.       EchoColor GENTEXTCOL
  1930.       print "^M^J^M^JCurrent Message Area #",areanum," - ",area
  1931.       put "^M^J^M^JCurrent Message Area #",areanum," - ",area                              
  1932.       print "^M^J",timeleft,XPERTCOMMAND,
  1933.       put "^M^J",timeleft,XPERTCOMMAND,
  1934.     else
  1935.       chdir HOSTDIR
  1936.       TypeFile "MENUANS.HST",FALSE  ; display ansi menu
  1937.       chdir TMDIR
  1938.       Timeup
  1939.       LocalView
  1940.       EchoColor GENTEXTCOL
  1941.       at 0,20
  1942.       print "Current Message Area #",areanum," - ",area
  1943.       put "Current Message Area #",areanum," - ",area                              
  1944.       print timeleft,MENUCOMMAND,
  1945.       put "^M^J",timeleft,MENUCOMMAND,
  1946.     endif
  1947.   else
  1948.     if xpert
  1949.       Timeup
  1950.       LocalView
  1951.       print "^M^J^M^JCurrent Message Area #",areanum," - ",area
  1952.       put "^M^J^M^JCurrent Message Area #",areanum," - ",area                              
  1953.       print "^M^J",timeleft,XPERTCOMMAND,
  1954.       put "^M^J",timeleft,XPERTCOMMAND,
  1955.     else
  1956.       chdir HOSTDIR
  1957.       TypeFile "MENUTXT.HST",FALSE ; display text menu
  1958.       chdir TMDIR
  1959.       Timeup
  1960.       LocalView
  1961.       at 0,20
  1962.       print "Current Message Area #",areanum," - ",area
  1963.       put "Current Message Area #",areanum," - ",area                              
  1964.       print timeleft,MENUCOMMAND,
  1965.       put "^M^J",timeleft,MENUCOMMAND,
  1966.     endif
  1967.   endif
  1968.   if userlevel = SYSOPLEVEL
  1969.     Echo "(H,V) "
  1970.   endif
  1971.   InputEcho ch
  1972.   if ch<>"^M"
  1973.     Echo "^M^J"
  1974.   endif
  1975.   switch ch
  1976.     case "F":                      ; file directory
  1977.       EchoClearScreen
  1978.       chdir DOWNLOADDIR
  1979.       Directory
  1980.     case "T":                      ; type a file
  1981.       clear com
  1982.       EchoClearScreen
  1983.       chdir DOWNLOADDIR
  1984.       Directory
  1985.       EchoColor GENTEXTCOL
  1986.       Echo "^M^JListing of files in host directory...."
  1987.       Echo "^M^JOnly files with extension .TXT should be typed.^M^J^M^J"
  1988.       Echo "Enter filename: " 
  1989.       EchoColor HILITECOL
  1990.       InputFilename filename,DOWNLOADDIR 
  1991.       strpos filename,"TXT",pos 
  1992.       if pos = 0
  1993.         Echo "^M^JFile must have .TXT extension"
  1994.         Delay 20
  1995.       else
  1996.         if success
  1997.           chdir DOWNLOADDIR
  1998.           EchoNormal
  1999.           TypeFile filename,TRUE
  2000.         endif
  2001.       endif
  2002.     case "C":                      ; chat
  2003.       clear com
  2004.       clear text
  2005.       EchoClearScreen
  2006.       Echo "Paging the Sysop, hang on a second!^M^J"
  2007.       alarm "User would like to chat...^JPress [Enter] to accept, [Esc] to deny"
  2008.       if success
  2009.         print "^M^JSYSOP: press [Esc] to terminate chat mode"
  2010.         ChatMode
  2011.       else
  2012.         Echo "^M^JSorry, Sysop is not here^M^J"
  2013.       endif
  2014.     case "U":                      ; upload a file
  2015.       clear com
  2016.       clear text
  2017.       chdir HOSTDIR
  2018.       if ANSIREMOTE 
  2019.         Typefile "PROTOANS.HST",FALSE  ; ansi file
  2020.         EchoColor GENTEXTCOL
  2021.       else
  2022.         TypeFile "PROTOTXT.HST",FALSE
  2023.       endif
  2024.       at 5,20
  2025.       Echo "Select protocol: "   
  2026.       InputEcho protocol
  2027.       Echo "^M^J"
  2028.       if LOCAL
  2029.         Echo "Function not available in local mode^M^J" 
  2030.         delay 10
  2031.       else
  2032.         switch protocol
  2033.           case "I":
  2034.             Bimod
  2035.           case "X","R":
  2036.             Echo "Enter filename: "
  2037.             InputFilename filename,""
  2038.             if success
  2039.               FileTransfer "r",protocol,filename
  2040.             endif
  2041.           case "Z","S","T","M","Y","B","G":
  2042.             FileTransfer "r",protocol,""
  2043.         endswitch
  2044.       endif
  2045.     case "D":                      ; download a file 
  2046.       clear com
  2047.       clear text
  2048.       chdir HOSTDIR
  2049.       if ANSIREMOTE 
  2050.         Typefile "PROTOANS.HST",FALSE 
  2051.         EchoColor GENTEXTCOL
  2052.       else
  2053.         TypeFile "PROTOTXT.HST",FALSE
  2054.       endif
  2055.       chdir DOWNLOADDIR  
  2056.       at 5,20
  2057.       Echo "Select protocol: "   
  2058.       InputEcho protocol
  2059.       Echo "^M^J"
  2060.       if LOCAL
  2061.         Echo "Function not available in local mode^M^J"
  2062.         delay 10
  2063.       else
  2064.         switch protocol
  2065.           case "I":
  2066.             Bimod
  2067.           case "X","Y","Z","S","T","M","R","B","G":
  2068.             Echo "Enter filename: "
  2069.             InputFilename filename,DOWNLOADDIR
  2070.             if success
  2071.               FileTransfer "s",protocol,filename
  2072.             endif
  2073.         endswitch
  2074.       endif
  2075.     case "X":                      ; toggle expert mode
  2076.       xpert = not xpert
  2077.     case "A":                      ; access, change area and
  2078.       AccessMsg                    ; read or enter message.
  2079.     case "E":                      ; enter message in base already selected 
  2080.       name = ""
  2081.       subject = ""
  2082.       addmsg = 0
  2083.       EnterMsg 
  2084.       WriteNewRecord name
  2085.     case "R":                      ; read messages
  2086.       if MSGBASE = MSBASE0         ; message to sysop
  2087.         If userlevel = SYSOPLEVEL  ; read by sysop only
  2088.           ReadMsg
  2089.         else
  2090.           Echo "^M^J^M^JThese are PRIVATE messages!"
  2091.           delay 10 
  2092.         endif
  2093.       else
  2094.         ReadMsg                    ; other areas
  2095.         WriteNewRecord name
  2096.       endif
  2097.     case "M":                      ; or leave message to Sysop
  2098.       areanum = 1
  2099.       area = area0
  2100.       MSGBASE = MSBASE0
  2101.       subject = ""
  2102.       EnterMsg                     ; leave message
  2103.     case "G":                      ; goodbye
  2104.       chdir HOSTDIR
  2105.       if ANSIREMOTE
  2106.         Typefile "BYEANS.HST",FALSE
  2107.         InputEcho ""
  2108.       else
  2109.         TypeFile "BYETXT.HST",FALSE
  2110.         InputEcho ""
  2111.       endif
  2112.       Disconnect
  2113.       Usage "User logged off"
  2114.       chdir TMDIR
  2115.     case "Q":                      
  2116.       Questionnaire
  2117.     case "B":                      ; show bulletins
  2118.       EchoClearScreen
  2119.       EchoNormal
  2120.       chdir HOSTDIR
  2121.       Typefile "BULLETIN.HST",TRUE
  2122.       chdir TMDIR                         
  2123.       Usage "User read bulletins......"
  2124.     case "Y":                      ; user statistics
  2125.       Statistics
  2126.     case "S":                      ; shell to DOS
  2127.       if userlevel<SYSOPLEVEL
  2128.         Echo "Sorry, this command is for Sysop only^M^J"
  2129.         delay 10
  2130.       else
  2131.         chdir HOSTDIR
  2132.         if LOCAL                   ; local mode shell to DOS
  2133.           Echo "Shelling to DOS ... ^M^J"
  2134.           dos
  2135.           Echo "Return from DOS shell^M^J"
  2136.         else
  2137.           fileexist "hshell.bat",exist   ; check for HSHELL.BAT
  2138.           if exist
  2139.             Echo "Shelling to DOS ... ^M^J"
  2140.             dos "hshell.bat"
  2141.             Echo "Return from DOS shell^M^J"
  2142.           else
  2143.             Echo "SYSOP: Cannot find HSHELL.BAT^M^J"
  2144.           endif
  2145.         endif
  2146.       endif
  2147.     case "V":                      ; view log when remote 
  2148.       if userlevel<SYSOPLEVEL
  2149.         Echo "Sorry, this command is for Sysop only^M^J"
  2150.         delay 10
  2151.       else
  2152.         EchoClearScreen
  2153.         EchoNormal
  2154.         dos "D:"
  2155.         chdir TMLOG
  2156.         Typefile "TM.USE",TRUE     ; view log
  2157.         dos "C:"
  2158.         chdir TMDIR
  2159.       endif
  2160.     case "?":                      ; show help file of available
  2161.       chdir HOSTDIR                ; commands
  2162.       Typefile "HELP.HST",TRUE
  2163.       chdir TMDIR
  2164.     case "H":                      ; shut down host mode
  2165.       if userlevel<SYSOPLEVEL
  2166.         Echo "Sorry, this command is for Sysop only^M^J"
  2167.         delay 10
  2168.       else
  2169.         Echo "Are you sure [y/N]? "
  2170.         InputString ch
  2171.         if ch="y"
  2172.           Echo "Shutting down host mode^M^J"
  2173.           Disconnect
  2174.           HostEnd
  2175.         endif
  2176.       endif
  2177.     endswitch
  2178. Endproc
  2179.  
  2180. ;
  2181. ; begin main program
  2182. ;
  2183. while FOREVER
  2184.   HostConfig                       ; read configuration file TMHCFG.HST
  2185.   HostBegin                        ; initial mode
  2186.   WaitForCall                      ; wait for a call
  2187.   while connected
  2188.     DoCommand                      ; do commands
  2189.   endwhile
  2190. endwhile
  2191.  
  2192.